const log4js = require('log4js')

log4js.configure({
  appenders: {
    console: { type: 'console' },
    logstash: {
      type: 'log4js-logstash-tcp',
      host:global.COM_CONFIG.logstashHost,
      port:global.COM_CONFIG.logstashPort,
      fields: {
        application: 'node-service',
        esindex: 'school-logs-dev'
      }
    }
  },
  categories: {
    default: { appenders: ['logstash', 'console'], level: 'debug' }
  }
})

module.exports = log4js.getLogger('default')